<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ taglib prefix="dgg" uri="/dgg-tags" %>
<div class="dialog-warp-ajax">
    <c:if test="${!empty orderList}">
        <div>
            <span style="color: red;background: #FAEBD7;padding:8px;border-radius:5px">
                跨事业部移交：将订单及订单下的所有生产订单移交到同业态下的其他事业部进行处理，订单生产所属发生变化。
            </span>
            <table class="dggui-table-info">
                <tbody>
                <input type="hidden" id="orderId" value="${orderList[0].orderId}">
                <tr>
                    <th>客户名称：</th>
                    <td>${orderList[0].customerName}
                        <span>(</span>
                        <dgg:ennumber number="${orderList[0].customerPhone}"/>
                        <span>)</span>
                    </td>
                    <th>订单编号：</th>
                    <td>${orderList[0].orderNo}</td>
                </tr>
                <tr>
                    <th>办理业务：</th>
                    <td>${productNames}</td>
                    <th>签单商务：</th>
                    <td>${orderList[0].signUserName}</td>
                </tr>
                <tr>
                    <th>签单时间：</th>
                    <td><fmt:formatDate value="${orderList[0].signTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <th>订单金额：</th>
                    <td>${orderList[0].money}元</td>
                </tr>
                </tbody>
            </table>
        </div>
    </c:if>
    <c:if test="${!empty orderList}">
        <%--<div class="dggui-panel">--%>
            <h4 class="tit-sm">相关生产订单</h4>
            <table class="dggui-table cell-border table-form">
                <thead>
                <th>生产订单编号</th>
                <th>生产订单状态</th>
                <th>办理业务</th>
                <th>最新节点</th>
                <th>流程人员</th>
                <th>所在部门</th>
                </thead>
                <tbody>
                <c:if test="${! empty orderList}">
                    <c:forEach var="po" items="${orderList}">
                        <tr>
                            <td><a href="javascript:void(0)" class="iboss-link" onclick="openOrderInfoDetail('${po.scProductOrderNo}','${po.id}')">${po.scProductOrderNo}</a></td>
                            <td>${po.status}</td>
                            <td>${po.productName}</td>
                            <td>${po.latestEndNodeName}</td>
                            <td>${po.flowUserName}</td>
                            <td>${po.flowUserOrgName}</td>
                        </tr>
                    </c:forEach>
                </c:if>
                </tbody>
            </table>
        <%--</div>--%>
    </c:if>
    <div class="distribPersonel popups-info" id="allotBox">
        <table class="add-table form-table">
            <tr>
                <th><span class="form-label required">选择移交事业部：</span></th>
                <td>
                    <div class="title-list">
                        <div class="layui-inline select2-inline">
                            <div class="layui-input-inline">
                                <%--<input type="text" style="width: 180px" class="input-style" autocomplete="off"
                                       id="selectTreeAddRessId" name="selectTreeAddRessId"
                                       data-id="" data-orgid="" placeholder="请选择最下级的所属事业部"/>
                                    <%--<ul class="ztree my-tree" id="simpleTree"></ul>--%>
                                <select id="productOrgId" name="productOrgId" ></select>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<script type="text/javascript">
    /*dggui.use(['ztree','code'], function (){
        var $ = dggui.jquery;
        var ztree=dggui.ztree,
            code=dggui.code;
        var setting = {
            data: {
                simpleData: {
                    enable: true
                }
            }
        };
        var zNodes =[];
        dggui.dialog.loading();
        $.post(sysInfo.basePath+"/rzsc/common/orgs_tree_List.do?orgId=1280&&eDistance=2",{},function(result){
            dggui.dialog.loading('close');
            console.log(result);
            if(result.code==0){
                zNodes = result.data;
            }else{
                dggui.dialog.errors(result.msg);
            }
        },'json');
        ztree.render({
            elem:$('#simpleTree'),
            setting:setting,
            zNodes:zNodes
        });
    });*/
    dggui.use(['select2'], function (){
        var select2 = dggui.select2;
        syb("#productOrgId");
        select2.render({
            placeholder: "请选择",
            elem: $('#productOrgId'),
            allowClear: true,
            width: "190px"
        });
    });
    function saveOrgTransfer(orderId,index,obj){
        var productId = $("#productOrgId").val();
        dggui.dialog.loading();
        $.ajax({
            url:sysInfo.basePath + "/all_order/save_turn_over_org.do",
            type:'post',
            data:{orderId:orderId,productId:productId},
            dataType:'json',
            success:function(data){
                dggui.dialog.loading('close');
                if (data.code == 0) {
                    layer.close(index);
                    dggui.dialog.succeed('移交成功！');
                    //刷新列表
                    //search($('#flowNode'));
                    reloadTable(obj,"reloadFalse");
                } else {
                    dggui.dialog.errors(data.msg);
                }
            },
            error: function () {
                dggui.dialog.loading('close');
                dggui.dialog.errors('移交失败，请联系管理员！！');
            }
        });
    }
/*$(function(){
    $('#selectTreeAddRessId').selectTree({
        check: false,   //默认为false，单选；设置为 true ，为多选
        search: true,
        parentIsCheck: false,
        url: "{basePath}/zzsc/common/orgs_tree_List.do?orgId=1280&&eDistance=2",//请求路 径
        form: true,
        idName: 'orgId',
        idKey: "id",//指定id
        pIdKey: "pId",//指定pId
        dataFilter: function (treeId, parentNode, responseData) {
            console.log(responseData);
            return responseData.data;
        }

    });
    //初始化下拉数据
});*/
</script>